package com.wlr.blog.controller;


import com.wlr.blog.service.IArticleService;
import com.wlr.blog.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wlr
 * @since 2021-07-31
 */
@RestController
@RequestMapping("/blog/article")
public class ArticleController {
    @Autowired
    IArticleService articleService;
    @RequestMapping
    public Result getAll(){
        return Result.success(articleService.list());
    }
    @RequestMapping("/{id}")
    public Result getOne(@PathVariable Integer id){
        return Result.success(articleService.getById(id));
    }
}
